package com.java.io.serializable.transientTest;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 * 被transient修饰的变量不能被序列化
 */
public class Client {
	public static void main(String[] args) throws Exception {
		Client tt = new Client();
		tt.test();
	}
	public void test() throws Exception {
		Transient ti = new Transient(4, 5); 
		System.out.println(ti.toString()); 
	    ObjectOutputStream o = new ObjectOutputStream(new FileOutputStream("D:/ti.out"));
	    o.writeObject(ti); 
	    o.close(); 
	    ObjectInputStream in =new ObjectInputStream(new FileInputStream("D:/ti.out")); 
	    Transient logInfo = (Transient)in.readObject(); 
	    System.out.println(logInfo.toString()); 
	}
}
